{% extends "base.html" %}
{% block title %}用户管理{% end %}
{% block content %}
<div class="pace  pace-inactive">
    <div class="pace-progress" data-progress-text="100%" data-progress="99" style="width: 100%;">
        <div class="pace-progress-inner"></div>
    </div>
    <div class="pace-activity"></div>
</div>
<div id="wrapper">
    {% include 'admin_nav.html' %}
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <div class="row border-bottom">
            {% include 'header_nav.html' %}
        </div>
        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-10">
                <h2>用户管理</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="/admin/home">主页</a>
                    </li>
                    <li>
                        <a href="/admin/userlist">用户管理</a>
                    </li>
                    <li>
                        <strong>用户列表</strong>
                    </li>
                </ol>
            </div>
            <div class="col-lg-2">

            </div>
        </div>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">


                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <div class="row">
                                <form action="" method="post" id="search">
                                    {% module xsrf_form_html() %}
                                    <div class="input-group">
                                        <input type="text" placeholder="查找用户,用户名/会员编号/手机号" value="{{search}}"
                                               name="search" class="input form-control">
                                        <span class="input-group-btn">
                                                <button type="submit" class="btn btn btn-primary"><i
                                                        class="fa fa-search"></i>
                                                    搜索
                                                </button>
                                        </span>
                                    </div>
                                </form>
                            </div>
                            <div class="ibox-tools">
                                <a class="collapse-link">
                                    <i class="fa fa-chevron-up"></i>
                                </a>


                                <a class="close-link">
                                    <i class="fa fa-times"></i>
                                </a>
                            </div>
                        </div>
                        <div class="ibox-content">
                            <style>
                                th:first-child,
                                .gradeX td:first-child {
                                    width: 20px;
                                    cursor: pointer;
                                }

                                th:first-child input,
                                .gradeX td:first-child input {
                                    cursor: pointer;
                                }
                            </style>
                            <form action="javascript:;" method="post" name="login_form" id="login_form">
                                {% module xsrf_form_html() %}
                                <table class="table table-striped table-bordered table-hover dataTables-example">
                                    <thead>
                                    <tr>
                                        <th><input type="checkbox" class="i-checks" id="userListCheck"/></th>
                                        <th>UID</th>
                                        <th>用户名</th>
                                        <th>申请金额</th>
                                        <th>申请时间</th>
                                        <th colspan="2">提现账号</th>
                                        <th>激活币</th>
                                        <th>金币</th>
                                         <th>状态</th>
                                        <th style="text-align: center">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {% for r in records %}
                                    {%set user=user_info(r.get('uid'))%}
                                    <tr class="gradeX">
                                        <td><input type="checkbox" class="i-checks"></td>
                                        <td class="userListId">{{ r.get('uid','无') }}</td>
                                        <td>{{user.get('username','未知')}}</td>
                                        <td>{{r.get('money')}}</td>
                                        <td>{{r.get('time')}}</td>
                                        <td>{{r.get('account',{}).get('type','')}}</td>
                                        <td>{{r.get('account',{}).get('account','')}} {{user.get('real_name','')}}</td>
                                        <td>{{user.get('money','')}}</td>
                                        <td>{{user.get('jinbi','')}}</td>
                                        <td>
                                            {% if r.get('status')=='submit' %}
                                            待处理
                                            {%elif r.get('status')=='paid'%}
                                            已确认
                                            {%else%}
                                            未知
                                            {%end%}
                                        </td>
                                        <td>
                                            {%if  r.get('status')=='submit'%}
                                            <a href="javascript:;" data-id="{{r.get('id')}}"
                                               class="confirm_paid">确认</a>
                                            {%else%}
                                            已处理
                                            {%end%}
                                        </td>
                                    </tr>
                                    {% end %}
                                    </tbody>
                                </table>
                                <div class="row">
                                    <div class="col-sm-12">
                                        <div class="dataTables_info" id="DataTables_Table_0_info" role="alert"
                                             aria-live="polite" aria-relevant="all">第{{current_page}}页/总共{{pages}}页
                                            总共{{counts}}条 每页20条
                                        </div>
                                    </div>
                                    <div class="col-sm-12">
                                        <div class="dataTables_paginate paging_simple_numbers"
                                             id="DataTables_Table_0_paginate">
                                            <ul class="pagination">
                                                <!--<li class="paginate_button previous disabled"-->
                                                <!--aria-controls="DataTables_Table_0" tabindex="0"-->
                                                <!--id="DataTables_Table_0_previous"><a href="#">上一页</a></li>-->
                                                {% if pages>1 %}
                                                {% for p in range(1,pages+1) %}
                                                <li class="paginate_button {%if current_page==p%}active{%end%}"
                                                    aria-controls="DataTables_Table_0"
                                                    tabindex="0"><a href="?page={{p}}">{{ p }}</a></li>
                                                {% end %}
                                                {% end %}


                                                <!--<li class="paginate_button next" aria-controls="DataTables_Table_0"-->
                                                <!--tabindex="0" id="DataTables_Table_0_next"><a href="#">下一页</a></li>-->
                                            </ul>
                                        </div>
                                    </div>
                                </div>





                            </form>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>

    $(function () {

         $(".confirm_paid").click(function () {
            var base_url = "/admin/paid_crash?type=paid&id=";
            var uid = $(this).data("id");
            var tip = "警告!您确定已收款吗?";
            if (confirm(tip)) {
                window.location = base_url + uid;
                return true;
            }
            return false;
        })


    });
</script>

{% end %}